import request from '@/utils/request'

export function saveCourseInfo(courseInfo) {
  return request({
    url: `/admin/edu/course/saveCourseInfo`,
    method: 'post',
    data: courseInfo
  })
}

export function getCourseById(id) {
  return request({
    url: `/admin/edu/course/getCourseById/${id}`,
    method: 'get'
  })
}

export function updateCourseInfoById(courseInfo) {
  return request({
    url: '/admin/edu/course/updateCourse',
    method: 'put',
    data: courseInfo
  })
}

export function getPageList(page, limit, searchObj) {
  return request({
    url: `/admin/edu/course/list/${page}/${limit}`,
    method: 'get',
    params: searchObj
  })
}

export function removeById(id) {
  return request({
    url: `/admin/edu/course/delete/${id}`,
    method: 'delete'
  })
}

export function batchRemove(idList) {
  return request({
    url: `/admin/edu/course/batchDelete`,
    method: 'delete',
    data: idList
  })
}

export function getCoursePublishById(id) {
  return request({
    url: `/admin/edu/course/coursePublish/${id}`,
    method: 'get'
  })
}

export function publishCourseById(id) {
  return request({
    url: `/admin/edu/course/publishCourse/${id}`,
    method: 'put'
  })
}
